package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 支付方式(1-微信，2-网银对公)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum PayTypeEnum {

    WX(1, "微信"),
    BANK(2, "网银对公打款"),
    GIVE(3, "赠送")
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    PayTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static PayTypeEnum typeOf(Integer value) {
        PayTypeEnum[] values = PayTypeEnum.values();
        for (PayTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static PayTypeEnum typeOf(String name) {
        PayTypeEnum[] values = PayTypeEnum.values();
        for (PayTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
